package com.hnqcgc.fz.db;

import java.sql.*;

public abstract class IConnection {
    public abstract Connection getConn()throws SQLException;
    //释放资源
    public void closeAll(PreparedStatement ps, Statement s, ResultSet rs){
        if(ps!=null){
            try {
                ps.close();
            } catch (SQLException throwables) {
                throwables.printStackTrace();
            }
        }
        if(s!=null){
            try {
                s.close();
            } catch (SQLException throwables) {
                throwables.printStackTrace();
            }
        }
        if(rs!=null){
            try {
                rs.close();
            } catch (SQLException throwables) {
                throwables.printStackTrace();
            }
        }
    }
}
